package com.codenum.codegenerator;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

/**
* the Hjodcvta type
*/
@SuppressWarnings("ALL")
public class Hjodcvta {


        private static volatile Hjodcvta instance;

        /**
        * 方法MethodMap
        */
        private Map<String, Method> methodMap = new HashMap<>(32);

        private Map<String, Object> saleTypeMap = new HashMap<>(64);

        public static Hjodcvta getInstance() {
            if (instance == null) {
                synchronized (Hjodcvta.class) {
                    if (instance == null) {
                        instance = new Hjodcvta();
                    }
                }
            }
            return instance;
        }


        private Hjodcvta() {

        }



    public  Boolean judgeSbamehdsow(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeZefoczmhgo(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeWemiwhvabm(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeHycpreemas(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeDtqertnbvd(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeCkeyrgtbrh(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeOqosnuacys(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeHtkbwjwsag(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeCowkkdwlpq(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }

    private String  sbamehdsow;
    private String  zefoczmhgo;
    private String  wemiwhvabm;
    private String  hycpreemas;
    private String  dtqertnbvd;
    private String  ckeyrgtbrh;
    private String  oqosnuacys;
    private String  htkbwjwsag;
    private String  cowkkdwlpq;


    public void setSbamehdsow(String sbamehdsow){
    this.sbamehdsow = sbamehdsow;
    }

    public String getSbamehdsow(){
    return this.sbamehdsow;
    }
    public void setZefoczmhgo(String zefoczmhgo){
    this.zefoczmhgo = zefoczmhgo;
    }

    public String getZefoczmhgo(){
    return this.zefoczmhgo;
    }
    public void setWemiwhvabm(String wemiwhvabm){
    this.wemiwhvabm = wemiwhvabm;
    }

    public String getWemiwhvabm(){
    return this.wemiwhvabm;
    }
    public void setHycpreemas(String hycpreemas){
    this.hycpreemas = hycpreemas;
    }

    public String getHycpreemas(){
    return this.hycpreemas;
    }
    public void setDtqertnbvd(String dtqertnbvd){
    this.dtqertnbvd = dtqertnbvd;
    }

    public String getDtqertnbvd(){
    return this.dtqertnbvd;
    }
    public void setCkeyrgtbrh(String ckeyrgtbrh){
    this.ckeyrgtbrh = ckeyrgtbrh;
    }

    public String getCkeyrgtbrh(){
    return this.ckeyrgtbrh;
    }
    public void setOqosnuacys(String oqosnuacys){
    this.oqosnuacys = oqosnuacys;
    }

    public String getOqosnuacys(){
    return this.oqosnuacys;
    }
    public void setHtkbwjwsag(String htkbwjwsag){
    this.htkbwjwsag = htkbwjwsag;
    }

    public String getHtkbwjwsag(){
    return this.htkbwjwsag;
    }
    public void setCowkkdwlpq(String cowkkdwlpq){
    this.cowkkdwlpq = cowkkdwlpq;
    }

    public String getCowkkdwlpq(){
    return this.cowkkdwlpq;
    }

    void setMethodMap(Map<String, Method> methodMap) {
        this.methodMap = methodMap;
    }

   void setSaleTypeMap(Map<String, Object> saleTypeMap) {
        this.saleTypeMap = saleTypeMap;
    }

    public Boolean judgeAttributeValue(String saleType, String methodName) {
        try {
            Object saleTypeObject = saleTypeMap.get(saleType);
            String targetMethod = methodName.replace("judge", "get");
            String attr = methodName.replace("judge", "");
            Method method = methodMap.get(targetMethod);
            Object invoke = method.invoke(saleTypeObject);
            return Objects.isNull(invoke) ? Boolean.FALSE : Objects.equals(invoke.toString().toLowerCase(), attr.toLowerCase());
        } catch (InvocationTargetException e) {
            throw new RuntimeException(e.getMessage());
        } catch (IllegalAccessException e) {
            throw new RuntimeException(e.getMessage());
        }
    }

}